package net.seehope.foodie.controller;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.seehope.foodie.common.JsonResult;
import net.seehope.foodie.pojo.bo.OrdersBo;
import net.seehope.foodie.service.OrdersService;

@Api("订单相关API")
@RestController
@RequestMapping("/orders")
public class OrdersController {
	
	//TODO 安全问题需要自己保证，自己添加自己订单
	
	@Autowired
	private OrdersService ordersService;
	
	
	//POST请求
	@ApiOperation("接收前端的订单生成参数")
	@PostMapping("create")
	public JsonResult createOrders(@Valid @RequestBody OrdersBo bo) {
		return JsonResult.isOk(ordersService.createOrders(bo));
	}

}
